package com.indusfo.spc.mapper;

import com.indusfo.spc.pojo.Device;
import com.indusfo.spc.pojo.MaintainWork;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @Author louk
 * @Description 设备保养作业mapper
 * @Date 2019/12/12 17:14
 **/
public interface MaintainWorkMapper {
    int deleteByPrimaryKey(Integer maintainWorkId);

    int insert(MaintainWork record);

    int insertSelective(MaintainWork record);

    MaintainWork selectByPrimaryKey(Integer maintainWorkId);

    int updateByPrimaryKeySelective(MaintainWork record);

    int updateByPrimaryKey(MaintainWork record);


    /**
     * 新增设备保养作业
     * @param maintainWork
     * @return
     */
    int insertMaintainWork(MaintainWork maintainWork);

    /**
     * 审核状态修改
     * @param maintainWorkIds
     * @param auditState
     */
    int auditStateChange(@Param("maintainWorkIds") Integer[] maintainWorkIds, @Param("auditState") Integer auditState);

    /**
     * 数据状态修改
     * @param maintainWorkIds
     * @param dataState
     * @return
     */
    int defineDataState(@Param("maintainWorkIds") Integer[] maintainWorkIds, @Param("dataState") Integer dataState);

    /**
     * 查询设备保养计划
     * @param maintainWork
     * @return
     */
    List<MaintainWork> queryMaintainWorkList(@Param("maintainWork") MaintainWork maintainWork,@Param("startDate") String startDate,@Param("endDate") String endDate);

    /**
     * 计数设备保养计划
     * @param maintainWork
     * @return
     */
    int countMaintainWorkList(@Param("maintainWork") MaintainWork maintainWork,@Param("startDate") String startDate,@Param("endDate") String endDate);

    /**
     * 查询设备保养计划编码
     * @param maintainWork
     * @return
     */
    int queryWorkNo(MaintainWork maintainWork);

    /**
     * 查询设备对应的保养周期
     * @param maintainWorkIds
     * @return
     */
    List<Device> queryMaintainPeriod(@Param("maintainWorkIds") Integer[] maintainWorkIds);

    /**
     * 更新设备的保养时间
     * @param deviceList
     * @return
     */
    int updateDevice(@Param("deviceList") List<Device> deviceList);

    int updateMaintainWork(MaintainWork maintainWork);
    // 根据设备ID查询
    int selectByDeviceId(@Param("deviceIds") Long[] deviceIds);
}